﻿using System;
using System.Collections;
using RootMotion.FinalIK;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020000B8 RID: 184
	public class ResetInteractionObject : MonoBehaviour
	{
		// Token: 0x060005B7 RID: 1463 RVA: 0x00036BEC File Offset: 0x00034DEC
		public void Start()
		{
			this.defaultPosition = base.transform.position;
			this.defaultRotation = base.transform.rotation;
			this.defaultParent = base.transform.parent;
			this.r = base.GetComponent<Rigidbody>();
		}

		// Token: 0x060005B8 RID: 1464 RVA: 0x00005AE0 File Offset: 0x00003CE0
		public void OnPickUp(Transform t)
		{
			base.StopAllCoroutines();
			base.StartCoroutine(this.ResetObject(Time.time + this.resetDelay));
		}

		// Token: 0x060005B9 RID: 1465 RVA: 0x00036C38 File Offset: 0x00034E38
		public IEnumerator ResetObject(float resetTime)
		{
			while (Time.time < resetTime)
			{
				yield return null;
			}
			Poser poser = base.transform.parent.GetComponent<Poser>();
			if (poser != null)
			{
				poser.poseRoot = null;
				poser.weight = 0f;
			}
			base.transform.parent = this.defaultParent;
			base.transform.position = this.defaultPosition;
			base.transform.rotation = this.defaultRotation;
			if (this.r != null)
			{
				this.r.isKinematic = false;
			}
			yield break;
		}

		// Token: 0x040004C2 RID: 1218
		public float resetDelay = 1f;

		// Token: 0x040004C3 RID: 1219
		public Vector3 defaultPosition;

		// Token: 0x040004C4 RID: 1220
		public Quaternion defaultRotation;

		// Token: 0x040004C5 RID: 1221
		public Transform defaultParent;

		// Token: 0x040004C6 RID: 1222
		public Rigidbody r;
	}
}
